<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
session_start();
@require_once('config.php');
@require_once('oauth.php');
@require_once('opent.php');
@require_once('api_client.php');
if(!empty($_GET['q'])){
    $c = new MBApiClient(MB_AKEY , MB_SKEY , token_key , token_secret);
    $text   = base64_decode($_GET['q']);
    $p =array(
	'c' => $text,
	'ip' => $_SERVER['REMOTE_ADDR'],
	'j' => '',
	'w' => '',
	'type' => 1,
	'r' => time()
    );
    $result = $c->postOne($p);
    if($result['errcode'] == 0){
        $id =  $result['data']['id'];
        $p  = array('id' =>$id);
        $result = $c->getOne($p);
        if($result['errcode'] == 0){
            echo str_replace('http://url.cn/', '', $result['data']['origtext']);
        }
    }
}
?>
